package com.ct.ah.lab.service.impl;

import com.ct.ah.lab.dao.AssessDao;
import com.ct.ah.lab.entity.Assess;
import com.ct.ah.lab.entity.User;
import com.ct.ah.lab.service.IAssessService;
import com.ct.ah.lab.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("AssessService")
public class AssessServiceImpl implements IAssessService {
    @Autowired
    private AssessDao assessDao;
    @Autowired
    private IOrderService orderService;

    @Override
    public void save(Integer all,Integer happy, Integer deliver, Integer serve, String msg, Integer oid, User user) {
        Assess assess = new Assess();
        assess.setAlls(all);
        assess.setHappy(happy);
        assess.setOid(oid);
        assess.setServe(serve);
        assess.setDeliver(deliver);
        assess.setMsg(msg);
        assess.setUid(user.getUid());
        assess.setCreatedUser(user.getUsername());
        assessDao.save(assess);
        orderService.changeStatus(oid, 5, null, user);

    }

    @Override
    public Assess getAccessByOid(Integer oid, User user) {
        return assessDao.getByOid(oid);
    }
}
